package com.baizhi.controller;

import com.baizhi.entity.Product;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {
    @Value("${server.port}")//表示去到配置文件中获取配置信息
    private int port;//端口号
    @GetMapping("/selectOne/{id}")
    public String selectOne(@PathVariable("id") int id){
        String result="我是商品模块的selectOne方法，我的参数是："+id+"；我的端口号是"+port;
        System.out.println(result);
        return result;
    }
    @GetMapping("selectOne2/{id}")
    public Product selectOne2(@PathVariable("id")int id){
        return new Product(1,"商品名称");
    }

}
